package cn.stylefeng.guns.modular.gridsystem.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.gridsystem.service.ThirdPartyInterconnectionService;
import cn.stylefeng.guns.modular.gridsystem.model.param.ThirdPartyInterconnectionParam;
import javax.annotation.Resource;

/**
 * 第三方对接 控制器
 *
 * @author: ssy
 * @date: 2021/11/04 17:42
 */
@RestController
public class ThirdPartyInterconnectionController {

    @Resource
    private ThirdPartyInterconnectionService thirdPartyInterconnectionService;

    /**
     * 分页查询第三方对接
     *
     * @author ssy
     * @date 2021/11/04 17:42
     */
    @GetMapping("/thirdPartyInterconnection/page")
    @BusinessLog(title = "第三方对接_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(ThirdPartyInterconnectionParam thirdPartyInterconnectionParam) {
        return new SuccessResponseData(thirdPartyInterconnectionService.page(thirdPartyInterconnectionParam));
    }

    /**
     * 获取全部第三方对接
     *
     * @author ssy
     * @date 2021/11/04 17:42
     */
    @GetMapping("/thirdPartyInterconnection/list")
    @BusinessLog(title = "第三方对接_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(ThirdPartyInterconnectionParam thirdPartyInterconnectionParam) {
        return new SuccessResponseData(thirdPartyInterconnectionService.list(thirdPartyInterconnectionParam));
    }

    /**
     * 查看详情第三方对接
     *
     * @author ssy
     * @date 2021/11/04 17:42
     */
    @GetMapping("/thirdPartyInterconnection/detail")
    @BusinessLog(title = "第三方对接_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(ThirdPartyInterconnectionParam.detail.class) ThirdPartyInterconnectionParam thirdPartyInterconnectionParam) {
        return new SuccessResponseData(thirdPartyInterconnectionService.detail(thirdPartyInterconnectionParam));
    }

    /**
     * 添加第三方对接
     *
     * @author ssy
     * @date 2021/11/04 17:42
     */
    @PostMapping("/thirdPartyInterconnection/add")
    @BusinessLog(title = "第三方对接_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(ThirdPartyInterconnectionParam.add.class) ThirdPartyInterconnectionParam thirdPartyInterconnectionParam) {
        thirdPartyInterconnectionService.add(thirdPartyInterconnectionParam);
        return new SuccessResponseData();
    }

    /**
     * 删除第三方对接
     *
     * @author ssy
     * @date 2021/11/04 17:42
     */
    @PostMapping("/thirdPartyInterconnection/delete")
    @BusinessLog(title = "第三方对接_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(ThirdPartyInterconnectionParam.delete.class) ThirdPartyInterconnectionParam thirdPartyInterconnectionParam) {
        thirdPartyInterconnectionService.delete(thirdPartyInterconnectionParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑第三方对接
     *
     * @author ssy
     * @date 2021/11/04 17:42
     */
    @PostMapping("/thirdPartyInterconnection/edit")
    @BusinessLog(title = "第三方对接_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(ThirdPartyInterconnectionParam.edit.class) ThirdPartyInterconnectionParam thirdPartyInterconnectionParam) {
        thirdPartyInterconnectionService.edit(thirdPartyInterconnectionParam);
        return new SuccessResponseData();
    }


}
